#pragma strict

//////////////////////////////////////////////////////
///键码,KeyboardEvent(Keys..)处理gui中多按钮
//////////////////////////////////////////////////////

/**
	The names of keys follow this convention:

	Normal keys: "a", "b", "c" ...
	Number keys: "1", "2", "3", ...
	Arrow keys: "up", "down", "left", "right"
	Keypad keys: "[1]", "[2]", "[3]", "[+]", "[equals]"
	Modifier keys: "right shift", "left shift", "right ctrl", "left ctrl", "right alt", "left alt", "right cmd", "left cmd"
	Mouse Buttons: "mouse 0", "mouse 1", "mouse 2", ...
	Joystick Buttons (from any joystick): "joystick button 0", "joystick button 1", "joystick button 2", ...
	Joystick Buttons (from a specific joystick): "joystick button 0", "joystick button 1", "joystick 1 button 0", ...
	Special keys: "backspace", "tab", "return", "escape", "space", "delete", "enter", "insert", "home", "end", "page up", "page down"
	Function keys: "f1", "f2", "f3", ...
	
	
*/
class Keys{
	
	//vk.
	static var vkAlt:String 		= "&";
	static var vkCtrl:String 		= "^";
	static var vkWindows:String 	= "%";
	static var vkShift:String 		= "#";
	/** 
		return Event.KeyboardEvent(string);
		将返回的string作为Event.KeyboardEvent的入参
	*/
	static function Combine(modifier:String,keyCode:KeyCode):String{
		return modifier + keyCode.ToString();
	}
	static function Combine(modifier:String,keyChar:String):String{
		return modifier + keyChar;
	}
	
	/** return KeyboardEvent('&key') */
	static function Alt(keyCode:KeyCode):String{
		return Combine(vkAlt,keyCode);
	}
	
	static function Ctrl(keyCode:KeyCode):String{
		return Combine(vkCtrl,keyCode);
	}
	
	static function Shift(keyCode:KeyCode):String{
		return Combine(vkShift,keyCode);
	}
	
	static function CtrlAlt(keyCode:KeyCode):String{
		return Combine(vkCtrl + vkAlt,keyCode);
	}
	
	static function CtrlShift(keyCode:KeyCode):String{
		return Combine(vkCtrl + vkShift,keyCode);
	}
	static function ShiftAlt(keyCode:KeyCode):String{
		return Combine(vkShift + vkAlt,keyCode);
	}
	static function CtrlShiftAlt(keyCode:KeyCode):String{
		return Combine(vkCtrl + vkShift + vkAlt,keyCode);
	}
}